package com.leslie.app.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@NoArgsConstructor
@AllArgsConstructor
@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Result<T> success(T data) {
        return new Result<>(200, "Success", data);
    }

    public static Result success() {
        return new Result(0, "Success", null);
    }

    public static Result error(String message, Integer code) {
        return new Result(code , message, null);
    }
}
